/***************************************************************************
 * This document contains confidential and proprietary information
 * subject to non-disclosure agreements with AsiaInspection. This
 * information shall not be distributed or copied without written
 * permission from the AsiaInspection.
 ***************************************************************************/
package util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.digest.DigestUtils;

/***************************************************************************
 *<PRE>
 *  Project Name    : com.allen
 *
 *  Package Name    : util
 *
 *  File Name       : PaawordShow.java
 *
 *  Creation Date   : Jul 12, 2016
 *
 *  Author          : Allen Zhang
 *
 *  Purpose         :
 *
 *
 *  History         :
 *
 *</PRE>
 ***************************************************************************/

public class PasswordShow {

	public static void main(String args[]) throws NoSuchAlgorithmException {
		String newPassword = "ProTest321";
//		if (args.length != 1) {
//			System.err.println("String to MD5 digest should be first and only parameter");
//			return;
//		}
//		String original = args[0];
		MessageDigest md = MessageDigest.getInstance("MD5");
		md.update(newPassword.getBytes());
		byte[] digest = md.digest();
		StringBuffer sb = new StringBuffer();
		for (byte b : digest) {
			sb.append(String.format("%02x", b & 0xff));
		}

		System.out.println("original:" + newPassword);
		System.out.println("md5:" + sb.toString());

		System.out.println("shaHex:" + DigestUtils.shaHex(sb.toString()));



	}
}
